package com.wangzhe.builder;

import com.wangzhe.bean.Constants;
import com.wangzhe.utils.DateTimeUtil;

import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Date;

/**
 * @author 王哲
 * @ClassName BuilderComment
 * @create 2023--六月--下午7:52
 * @Description 注释输出
 * @Version V1.0
 */
public class BuilderComment {
    /**
     * 构造类注释
     * @param bw
     */
    public static void createClassComment(BufferedWriter bw, String classComment){
        /**
         * @author 王哲
         * @ClassName BuilderComment
         * @create 2023--六月--下午7:52
         * @Description 注释输出
         * @Version V1.0
         */
        try {
            bw.write("/**");
            bw.newLine();
            bw.write(" * @Author\t" + ("".equals(Constants.AUTHOR_NAME)?"王哲":Constants.AUTHOR_NAME));
            bw.newLine();
            bw.write(" * @create\t" + DateTimeUtil.format(new Date(),DateTimeUtil.DATE_FORMAT_NYR));
            bw.newLine();
            bw.write(" * @Description\t" + classComment);
            bw.newLine();
            bw.write(" * @Version\tV1.0");
            bw.newLine();
            bw.write(" */");
            bw.newLine();
            bw.newLine();
            bw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
    /**
     * 构造字段注释
     * @param bw
     * @param comment
     */
    public static void createFieldComment(BufferedWriter bw, String comment){
        try {
            bw.write("\t/**");
            bw.newLine();
            bw.write("\t * " + comment);
            bw.newLine();
            bw.write("\t */");
            bw.newLine();
            bw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 构造方法注释
     * @param bw
     * @param comment
     */
    public static void createMethodComment(BufferedWriter bw, String comment){
        try {
            bw.write("\t/**");
            bw.newLine();
            bw.write("\t * " + comment);
            bw.newLine();
            bw.write("\t */");
            bw.newLine();
            bw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
